qcollect-traits 0.6.0

Traits for being generic over collection-types.
//! ### TODO
//!
//! * impl CollectReserve
//! * impl CollectInsert?

use traits::*;

use bit_vec::{self, BitVec, BitBlock};

impl<B: BitBlock> CollectLen for BitVec<B> {
    fn len(&self) -> usize { (*self).len() }
} 

impl<B: BitBlock> CollectCapacity for BitVec<B> {
    fn capacity(&self) -> usize { (*self).capacity() }
}

impl<B: BitBlock> CollectClear for BitVec<B> {
    fn clear(&mut self){ (*self).clear() }
}

impl<'a, B: BitBlock> _CollectGet<'a, usize> for BitVec<B> {
    type Output = bool;
}

impl<B: BitBlock> CollectGet<usize> for BitVec<B> {
    fn get<'a>(&'a self, idx: &usize) -> Option<<Self as _CollectGet<'a, usize>>::Output> { (*self).get(*idx) }
}

impl<'a, B: BitBlock + 'a> _CollectIter<'a> for BitVec<B> {
    type Iter = bit_vec::Iter<'a, B>;
}

impl<B: BitBlock + 'static> CollectIter for BitVec<B> {
    fn iter<'a>(&'a self) -> <Self as _CollectIter<'a>>::Iter { (*self).iter() }
}